#include "start.h"
#include "ui_start.h"
#include <QApplication>
#include <QTime>

Start::Start(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Start)
{
    ui->setupUi(this);
    this->setWindowTitle("开始");

    connect(&o,&Over::Mysignal,this,&Start::dealover);
    connect(&s,&Success::Mysignal,this,&Start::dealsuccess);
    connect(&ff,&FirstFloor::Oversignal,this,&Start::dealffover);
    connect(&ff,&FirstFloor::Successsignal,this,&Start::dealffsuccess);
    connect(&sf,&SecondFloor::Mysignal,this,&Start::dealsf);
    connect(&sfs,&SFSuccess::Mysignal,this,&Start::dealsfsnext);
    connect(&sfo,&SFOver::Mysignal,this,&Start::dealsfonext);
}
int bloods=3;
Start::~Start()
{
    delete ui;
}
void Start::on_pushButton_clicked()
{
    this->hide();
    tf.show();//
   // reachtime=QTime::currentTime().addMSecs(5000);//
}
void Start::dealover(){
    o.hide();
    this->show();
}
void Start::dealsuccess(){
    s.hide();
    this->show();
}
void Start::dealffover(){
    ff.hide();
    o.show();
}
void Start::dealffsuccess(){
    ff.hide();
    sf.show();
    reachtime=QTime::currentTime().addMSecs(5000);
}
void Start::dealsfsuccess(){
    sf.hide();
    sfs.show();
}
void Start::dealsfover(){
    sf.hide();
    sfo.show();
}
void Start::dealsf(){
    if(QTime::currentTime()<reachtime)
        Start::dealsfsuccess();
    else
        Start::dealsfover();
}
void Start::dealsfsnext(){
    sfs.hide();
    s.show();
}
void Start::dealsfonext(){
    sfo.hide();
    s.show();
}
